package com.spring.boot.feign;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import feign.hystrix.FallbackFactory;

/*打印feign日志*/
@Component
public class HystrixClientFactory implements FallbackFactory<TeacherFeign> {

	private static final Logger log = LoggerFactory.getLogger(HystrixClientFactory.class);

	@Override
	public TeacherFeign create(Throwable cause) {
		log.error("异常信息如下:", cause);
		return new TeacherFeign() {

			@Override
			public Object getMember(String name) {
				log.info("请求方法:{},请求参数:{}", "getMember",name);
				return "aaa";
			}

			@Override
			public Object getBody(String body) {
				log.info("请求方法:{},请求参数:{}", "getBody",body);
				return "bbb";
			}
			
		};
	}

}
